Methods and systems for start code emulation prevention and data stuffing

ABSTRACT

Methods and systems provide approaches to start code emulation prevention at a granularity higher than the bit level. By operating at a level other than the bit level, processing capability requirements on both the encoder and decoder side can be reduced. In accordance with one or more embodiments, a start code emulation prevention method looks for data patterns relative to fixed-size data portions larger than single bits. When a particular pattern is found, start code emulation prevention data is inserted to prevent start code emulation. The inserted data is larger than a single bit and, in some embodiments, comprises a byte. When a decoder decodes data that has had start code emulation prevention data inserted, it can easily identify legitimate start codes and then can remove the start code emulation prevention data to provide the original data that was protected. In addition, a data stuffing method is described which allows payload data to be rounded up in size to an integer number of byte sizes, and then allows filler data to be added in a manner which is easily detectable by a decoder.

RELATED APPLICATION

[0001] This application stems from and claims priority to U.S.Provisional Application Serial No. 60/351,142, filed on Jan. 22, 2002,the disclosure of which is incorporated by reference herein.

TECHNICAL FIELD

[0002] This invention relates to methods and systems for preventingstart code emulation and for data stuffing.

BACKGROUND

[0003] Digital data is typically transmitted from some type oftransmitter to some type of receiver. Transmitters typically include anencoder that encodes the data for transmission; and receivers typicallyinclude a decoder that decodes data that it receives. There aredifferent types of digital data such as video data, audio data,audio/video data, text data, computer executable program data, archivaldata, database information, and the like. When digital data istransmitted, it is typically transmitted in some type of channel.Equivalently, computer, memory or any storage device or storage mediumcan be considered a transmission channel for purposes herein.

[0004] When digital data is transmitted, it is important to be able tofind specific points within the data in the channel. This is done forvarious purposes, such as to locate points that enable recovery fromerrors or losses in the transmission of the data through the channel,points that enable starting the decoding process at a location otherthan the start of the entire stream, or points that enable searching fordifferent types of data that are utilized for different purposes. Thus,for example, on the decoder side, decoders and other components thatprocess digital data often need to know the context of the data so thatthe data can be properly processed. This would not be so important ifone was able to start with the first bit that was sent and the decoderwas able to run without any errors. In this situation, ideally, thedecoder could simply track the information that was being sent accordingto knowing what the format of the data is. Unfortunately, thisidealistic situation often does not occur. Errors and othercontingencies do occur that present challenges to those who design anduse systems that transmit and receive digital data. In some cases suchas when tuning into an ongoing broadcast stream of data, the decodercannot start at the beginning of the data transmission. Locating pointsby data format parsing may also require a significant amount of complexprocessing in a decoder.

[0005] In many types of channel environments, such issues are addressedby providing, in the data, so-called resynchronization markers.Resynchronization markers provide a mechanism by which a system canstart its decoding process or recover from an error. For example, whendigital data is streamed as a series of bits or bytes, havingresynchronization markers in the stream can provide a decoder with apoint of reference from which to recover in the event an error occurs inthe transmission.

[0006] One way that resynchronization markers can be employed is in thecontext of start codes. A start code is a string of bits or bytes havinga specific value. Generally, many systems tend to carry bytes (e.g.H.222.0/MPEG-2 Systems), so that start codes can be defined as auniquely-valued string of bytes. The unique string of bytes provides apattern the presence of which indicates a resynchronization point. Aresynchronization point typically indicates the start or boundary ofsome independently decodable amount of data. For example, inH.262/MPEG-2 Video data, resynchronization points can indicate the startof a slice (i.e. an independently decodable region of a picture), thestart of a picture, the start of a GOP (i.e., “Group of Pictures” orindependently decodable sequence of pictures), or the start of a newvideo sequence. Digital video streams can also include so-calledancillary or supplemental data which can be preceded by a start code.

[0007] Sometimes, start codes are used not only within a data streamsuch as a video stream, but are used by a system's multiplex level. TheH.222.0/MPEG-2 System specification is an example of a system that usesstart codes, and carries streams of video data interleaved withsystem-level information and audio information.

[0008] Since start codes can be important insofar as providingresynchronization points within a data stream, it is a good idea toavoid emulating start codes in the data stream in places that are not,in fact, intended to represent start codes.

[0009] For example, consider the following. Start codes define aspecific pattern of bits or bytes that can identify the start of a newunit of data. If one is sending arbitrary data in between the startcodes, then it is possible that the arbitrary data may, in and ofitself, contain the same pattern that one is using as a start code. Forexample, if one assumes that the data that is being carried iscompletely random, then if a start code is K bits long, the probabilityof accidentally emulating the start code in the bits starting at someparticular bit location is 1/2^(k).

[0010] In some cases, the judgment can be made that if the number ofbits in the start code is large, then it may be fairly unlikely for thestart code to be accidentally emulated. This is the case with respect tosome audio data formats. Typically, these formats do not utilize a veryhigh bit rate measured in bits per second, so it is not too likely thata start code will be accidentally emulated during any particularinterval of time. With respect to video data, this is generally not thecase as video often requires a much higher bit rate.

[0011] In past major video coding standards (with perhaps oneexception), the video syntax format within the data payload has beendesigned to avoid start code emulation. That is, if one knows what kindof data elements will make up the video syntax, then one can carefullydesign the syntax so that no accidental start codes can occur. Forexample, a start code in traditional video coding standards begins witha long string of 0-bits, followed by a 1-bit. This long string maycontain 23 0-bits followed by one 1-bit. Assume that most of the datathat is sent is entropy coded using variable length codes (oftenreferred to informally as Huffman codes). Variable length codes (VLCs)are defined for example purposes herein as variable-depthtree-structured codes that are utilized to select among a set ofrepresented symbols. One technique using binary-tree VLCs is to makesure that the path in the tree from the root to every leaf thatrepresents a valid symbol always has a “1” in it somewhere, and that thetree structure is not too deep.

[0012] Thus, for example, if one knows that every variable length codestring is no longer than 10 bits long and that every such string willhave at least one 1-valued bit in it, then one knows that there is noway that a sequence of coded data from the VLC can ever contain morethan 18 consecutive zero-valued bits. That is, the worst-case scenariowould be 1000000000 followed by 0000000001. Thus, if one designs thesyntax carefully and inspects the location of every 0- and every1-valued bit to ascertain how many 0's can occur in a row, one can use astart code that contains a longer string of 0's than can ever occur inthe syntax. For example, the syntax can be designed so that valid syntaxcan never contain 23 0's in a location that is not a start code. Thus,every occurrence of 23 0's should be a start code and the decoder shouldbe able to accurately detect start codes.

[0013] While the above-described operation appears straightforward, theoperation can be a fairly difficult undertaking because one has toinspect all of the possible data (at the bit level) that is going to besent, in every possible order in which it is going to be sent to ensurethat a start code pattern cannot accidentally be sent. This is anarduous method of syntax design that is prone to mistakes.

[0014] This bit-level inspection design process describes, generally,the way that many video coding specifications have been designed in thepast (i.e. H.261, MPEG-1, H.262/MPEG-2, most of H.263, and MPEG-4). Theone exception to this is Annex E of ITU-T Recommendation H.263 whichuses a technique called arithmetic coding to generate compressed bits inan algorithmic fashion from a mathematical specification. Here, there isan extra process at the end of the entropy encoder which inspects thebits that are generated and, on the encoder side, if there are too many0's in a row, a “marker” bit (a 1-bit) is inserted before apre-determined number of 0's are encountered. On the decoder side, thedecoder counts up the zeroes and if it encounters the critical number ofzeroes, it knows that it has encountered a real start code. If thedecoder sees one less zero than the critical number, it knows that thefollowing 1 bit is a marker bit inserted to avoid start code emulation,discards that bit, and takes the following bits as the continuation ofthe real data.

[0015] The problem with this solution is that it makes the encoder andthe decoder inspect and process the incoming data at the bit level.Analyzing and shifting the location of the data that is being processedby single bit positions becomes difficult and can undesirably tax thedecoder. Bit-wise shifting is also a processor-intensive operation.

[0016] Accordingly, this invention arose out of concerns associated withproviding improved methods and system for preventing start codeemulation.

SUMMARY

[0017] Methods and systems are described to provide approaches to startcode emulation prevention by operations performed at a granularityhigher than the bit level. By operating at a level other than the bitlevel, processing efficiencies can be enhanced. In accordance with oneor more embodiments, a start code emulation prevention method looks fordata patterns relative to fixed-size data portions larger than singlebits. When a particular pattern is found, start code emulationprevention data is inserted to prevent start code emulation. Theinserted data is larger than a single bit and, in some embodiments,comprises a byte. When a decoder decodes data that has had start codeemulation prevention data inserted, it can easily identify legitimatestart codes and then can remove the start code emulation prevention datato provide the original data that was intended to be conveyed.

[0018] In addition, a data stuffing method is described which allowspayload data to be rounded up in size to an integer number of bytesizes, and then allows filler data to be added in a manner which iseasily detectable by a decoder.

BRIEF DESCRIPTION OF THE DRAWINGS

[0019]FIG. 1 is a flow diagram that describes steps in a method inaccordance with one embodiment.

[0020]FIG. 2 is a flow diagram that describes steps in a method inaccordance with one embodiment.

[0021]FIG. 3 is a high level diagram of a computing environment inconnection with which one or more embodiments can be implemented.

DETAILED DESCRIPTION

[0022] Overview

[0023] The methods and systems described below provide approaches tostart code emulation prevention at a granularity higher than the bitlevel. By operating at a level higher than the bit level, processingefficiencies can be enhanced. In the context of this document, operatingat a level higher than the bit level is intended to refer to a processthat looks for data patterns relative to fixed-size data portions largerthan single bits. For example, fixed-size data portions can includebytes (i.e. 8 bits), “words” (i.e. 16 bits), “double-words” (32 bits)and the like. Thus, the inventive techniques can look for patternswithin and among bytes, words, and the like.

[0024] In addition, a data stuffing method is described which allowspayload data to be rounded up in size to an integer number of data unitsizes such as byte quantities, and allows filler data to be added in amanner which is easily detectable by a decoder.

[0025] In addition, while the examples provided below are discussed inthe context of video data, it is to be appreciated and understood thatthe inventive techniques can be employed in connection with any type ofdata that is typically encoded and decoded and with which start codeemulation prevention is desirable or necessary. Examples of such datainclude audio data, audio/video data, and the like.

[0026]FIG. 1 is a flow diagram that describes steps in a method inaccordance with one embodiment. The method can be implemented in anysuitable hardware, software, firmware or combination thereof. In theillustrated and described embodiment, the method is implemented, atleast in part in software. In addition, the reader will notice that themethod is illustrated as having two different branches—one designated“Encoder” and one designated “Decoder”. The “Encoder” branch illustratessteps that are carried out by or in connection with an encoder.Similarly, the “Decoder” branch illustrates steps that are carried outby or in connection with a decoder.

[0027] Step 100 obtains or generates a quantity of data that is intendedfor transmission after a start code. The data can comprise any suitabledata. Examples of types of data include, without limitation, quantitiesof video data, audio data, audio/video data and the like. Step 101prefixes the data with start codes. This step effectively adds startcodes to the data that is obtained or generated in step 100. Step 102checks or searches incoming data for one or more patterns of fixed-sizedata portions. In the illustrated and described embodiment, thepattern(s) that is(are) searched for comprise at least two fixed-sizedata portions and each individual data portion comprises at least twobits. Step 104 determines whether a pattern is found. If the pattern isnot found, the method branches to step 108 where the data can betransmitted.

[0028] If, on the other hand, the pattern is found, step 106 insertsstart code emulation prevention data relative to the data that containsthe pattern. In the illustrated and described embodiment, individualinstances of the start code emulation prevention data comprise more thanone bit. Preferably, the start code emulation prevention data comprisesan amount of data is that equal in number of bits to an individualfixed-size data portion. Thus, where a fixed-size data portion comprises8 bits (a quantity of data referred to as a byte), the start codeemulation prevention data comprises 8 bits. After the start codeemulation prevention data is inserted, step 108 transmits the data. Step110 determines whether there is additional data that is to betransmitted before the next start code. If there is, then the methodreturns to step 102 and proceeds as described above. If not, the methodcan determine, at step 111, whether there is additional data totransmit. If there is, the method branches back to step 100. If there isnot, then the method can terminate at step 112.

[0029] As an aside, consider the following. Note that one example of useof this particular technology is to separate the start code into a“start code prefix” and a “start code type” suffix, where the prefix isa single unique string of values and the suffix indicates the type ofdata that follows the start code. In particular, this is the structureof MPEG-2 and H.264/AVC start codes and is the structure used in thesection entitled “First Exemplary Method” below. An even more generalform of use that encompasses the prefix/suffix structure as a specialcase, is the general notion of having one or more start code patterns.Then, one can also have one or more emulation prevention patterns. Aslong as the various start code patterns are distinct from the variousemulation prevention patterns and all of these patterns are avoided inthe processing of the payload data, the scheme will functionaccordingly. Additionally, one should not necessarily assume that thestart code patterns are all the same length. This can be important inparticular cases because, for example, H.264/AVC uses can be interpretedas using multi-length start codes.

[0030] On the decoder side, consider the following. Once the start codeemulation prevention data has been inserted by the encoder, it can beidentified and removed or ignored at some point for the properinterpretation of the other data. Consider also that as the decoderreceives the transmitted data, it can look for the legitimate startcodes. Once it finds the legitimate start codes, it knows where thestart code-defined data boundaries are located. Now, the decoder canproceed to look for and remove the start code emulation prevention dataso that it can further process the real data.

[0031] Specifically, step 114 receives transmitted data that has beenprocessed by an encoder to prevent emulation of start codes. Step 118processes the data to find the start code. Once the start code has beenfound and appropriately processed (e.g. read and discarded), step 120searches the data to identify start code emulation prevention data. Oncethe start code emulation prevention data is found, step 122 removes thestart code emulation prevention data. Once the start code emulationprevention data has been removed, the data can be processed in a mannerthat is typical for the type of data that has been received. Forexample, the data can be consumed by a consumer device, as in step 124.

[0032] First Exemplary Method

[0033] The method about to be described illustrates but one specificexample of the method shown and described in FIG. 1. In the method aboutto be described, a byte of emulation prevention data is insertedwhenever a string of N+1 bytes of payload data matches either the entirestart code prefix, or matches the first N bytes of the start code prefixplus the value of the emulation prevention byte. This method adds dataless frequently than the method described in the section entitled“Second Exemplary Method”, and thus reduces the transmission capabilityrequirements to send the payload data.

[0034] The MPEG-2 start code prefix structure starts at a byte-alignedposition and has 23 0's followed by a 1. This start code prefix is setforth directly below:

00000000 00000000 00000001

[0035] This structure can be generalized as a pattern that comprisessome number of bytes N that have the same value, followed by some otherbyte that has a different value. In MPEG-2, one can say that N=2, andthe first two bytes are 0 (referred to below as “W”), and that the lastbyte is 1 (referred to below as “X”). Thus, the start code prefix hasthe following pattern:

WWX

[0036] After these three bytes, in MPEG-2, another byte follows andidentifies which kind of start code it is. This following byte isreferred to as “Y”. Essentially then, the start code consists of a startcode prefix WWX, followed by a byte Y that identifies the type of startcode. The entire MPEG-2 start code can be represented as:

WWXY

[0037] The start code prefix (WWX) has a fixed value, while Y has anumber of different values that indicate the type of start code (e.g.slice, picture, GOP, sequence, system, and the like).

[0038] In accordance with one embodiment, the data is processed lookingfor the pattern WWX. When the WWX pattern is found, start code emulationprevention data is inserted to prevent start code emulation. Here, thestart code emulation prevention data comprises a byte Z that has a valuethat is distinct from the values of the W and X bytes. Thus, assume thatthe encoder is inspecting bytes of data and notices the pattern WWX.Responsive to finding this pattern in the data, the encoder inserts abyte having value Z to provide the following pattern:

WWZX

[0039] At this point, the encoder has ensured that the payload data thatis to be transmitted and processed by the decoder does not accidentallyemulate a start code or start code prefix. Now consider the following.Just as the payload data had a chance of emulating a start code prefixby arbitrarily containing the WWX pattern, the payload data also has achance of arbitrarily emulating data that contains the start codeemulation prevention data. That is, the payload data might inherentlycontain the pattern WWZX. If this is the case and the encoder were notto do anything, when the decoder attempts to remove the start codeemulation prevention data, it will remove the Z byte which in this caseis real data.

[0040] Accordingly, in the described embodiments, the encoder isconfigured to prevent not only the payload data from emulating startcodes or start code prefixes, but the encoder is configured to preventthe data from emulating data patterns that result from the use of startcode emulation prevention data. Specifically, in this example, if theencoder identifies the pattern WWZ, it inserts a byte having the value Zbetween the second W and the Z to provide the following pattern (theinserted byte Z is the first Z to appear below):

WWZZ

[0041] Now, consider the processed data from the perspective of thedecoder. If the decoder sees any pattern of bytes that comprises WWZfollowed by either a Z or X, it knows that the first Z is an emulationprevention byte that was inserted by the encoder. Accordingly, thedecoder can discard the first Z. Thus, in this example, there are twosituations when an emulation prevention byte can be inserted. The firstsituation is when the data would accidentally emulate a start code orstart code prefix. The second situation is when the data wouldaccidentally emulate data that has had an emulation prevention byteinserted.

[0042] In either case, the decoder can simply look for the appropriatepattern, discard the emulation prevention byte, and process the data asusual.

[0043] To illustrate the above processing in a more programmaticfashion, consider the following. On the encoder side, to send a packetP[ ] of B bytes, starting with a start code prefix which consists of Nor more bytes of the same value W and a last byte of a different valueX, followed by an identifying start code type suffix of 1 byte havingthe value Y, we operate the following pseudo code process which insertsemulation prevention bytes having the value Z (where W, X, Y, and Z havedifferent values from each other, and P[B−1] is not equal to W), wherethe quantity of extra data to send to fill the channel is specified byE: int B, N, E, i, j; byte *P, W, X, Y, Z; for(j=0; j<N+E; j++) /* startcode prefix (SCP) */ send_byte( W ); /* jth byte of SCP */ send_byte( X); /* last byte of SCP */ send_byte( Y ); /* start code type suffix */for(i=j=0; i<B; i++) { if(j >= N && (P[i] == X || P[i] == Z)) }send_byte( Z ); j = 0; } send_byte( P[i] ); /* a byte of data payload */if (P [i] == W) j++; else      j=0; }

[0044] In the above pseudo-code, a function “send_byte( )” is assumed tooperate the transmission of a unit of data (process 108 in FIG. 1).

[0045] On the decoder side, to receive the packet, assume that thedecoder has already found, read, and discarded the known start codeprefix which consists of N or more bytes of the same value W and a lastbyte of a different value X. Assume also that we wish to read theunknown single-byte start code type suffix into a variable Y and to readthe packet of payload data into an array P[ ] and determine the amountof payload data and place the quantity indication in a variable B, whileremoving emulation prevention bytes having the value Z (where W, X, Y,and Z have different values from each other, and P[B−1] is not equal toW): int B, N, j, next; byte *P, W, X, Y, Z; /* assume start code prefixwas already read */ Y = receive_byte( ); /* start code type suffix */for(B=j=0, next=0; more_data() && !next; B++) { P[B] = receive_byte( );if(j >= N) { if(P[B] == W) j++; else{ j = 0; next = (P[B] == X); if(P[B]== Z) B−−; } }else if(P[B] == W) j++; else     j=0; } if(next) /*another start code found */ B −= j+1;

[0046] In the above pseudo-code, a function “receive_byte( )” is assumedto operate the reception of a unit of data and a function “more_data( )”is assumed to determine whether there are any more units of data to bereceived (these two functions comprising process 114 in FIG. 1).

[0047] The above-described method allows an arbitrary amount of W-valuestuffing prior to the start code. Formulations are equally possible thatfix the number of W-value prefixes to N.

[0048] Second Exemplary Method

[0049] The method about to be described illustrates but one otherspecific example of the method shown and described in FIG. 1. Here, themethod inserts a byte of emulation prevention data whenever a string ofN bytes of data in the payload matches the first N bytes of the startcode prefix, regardless of the value of the subsequent payload data.Using the nomenclature of the above example, if the data contains thepattern “WW” followed by anything, the method inserts an emulationprevention byte. Accordingly, when the encoder identifies the patternWW, it inserts an emulation prevention byte to provide the followingpattern:

WWZ

[0050] The distinction between the first-described method and the onedescribed immediately above is that the first method looks at the firstN+1 bytes to ascertain where to insert an emulation prevention byte,whereas the method described immediately above looks at the first Nbytes.

[0051] The first method reduces the quantity of extra data to betransmitted, while the method described immediately above operates usingsimpler rules. Thus, collectively both of the methods provide a choicebetween reducing the quantity of data transmitted and reducing rulecomplexity. With the first-described method, quantity of data is reducedrelative to that of the second-described method. With thesecond-described method, simpler rules are utilized.

[0052] To illustrate the above processing in a more programmaticfashion, consider the following. On the encoder side, to send a packetP[ ] of B bytes, starting with a start code prefix which consists ofexactly N bytes of the same value W and a last byte of a different valueX, followed by an identifying start code type suffix of 1 byte havingthe value Y, we operate the following pseudo code process which insertsemulation prevention bytes having the value Z (where W, X, Y, and Z havedifferent values from each other, and P[B−1] is not equal to W): int B,N, i, j; byte *P, W, X, Y, Z; for(j=0; j<N; j++) /* start code prefix(SCP) */ send_byte( W ); /* jth byte of SCP */ send_byte( X ); /* lastbyte of SCP */ send_byte( Y ); /* start code type suffix */ for(i=j=0;i<B; i++) } send_byte( P[i] ); /* a byte of data payload */ if( P[i] !=W ) j=0; else if(++j == N) } send_byte ( Z ); j = 0; } }

[0053] In the above pseudo-code, a function “send_byte( )” is assumed tooperate of the transmission of a unit of data (process 108 in FIG. 1).

[0054] On the decoder side, to receive the packet, assume that thedecoder has already found, read, and discarded the known start codeprefix which consists of exactly N bytes of the same value W and a lastbyte of a different value X, and that we wish to read the unknownsingle-byte start code type suffix into a variable Y and to read thepacket of payload data into an array P[ ] and determine the amount ofpayload data and place the quantity indication in a variable B, whileremoving emulation prevention bytes having the value Z (where W, X, Y,and Z have different values from each other, and P[B−1] is not equal toW): int B, N, j, k; byte *P, W, X, Y, Z; /* assume start code prefix wasalready read */ Y = receive_byte( ); /* start code type suffix */for(B=j=0, k=Z; more_data() && k != X; B++) { P[B] = receive_byte( );if(P[B] == W) { if(++j == N) { k = receive_byte( ); /* more_data()always */ if(k != Z && != X) declare_error( ); j = 0; } }else j = 0; }if(k == X) /* another start code found */ B −= N;

[0055] In the above pseudo-code, a function “receive_byte( )” is assumedto operate the reception of a unit of data and a function “more_data( )”is assumed to determine whether there are any more units of data to bereceived (these two functions comprising process 114 in FIG. 1).

[0056] It is believed that the above-described methods will expand thequantity of a large amount of ideal random input payload data by afactor of approximately 1/256^(N) for the second-described method and1/256^((N+1)) for the first-described method. These amounts are small ifN is large (e.g., 2 or greater, noting that N=2 for MPEG-2 start codes).The worst-case expansion factor for the payload is believed to be 1/Nfor the second-described method and 1/(N+1) for the first-describedmethod. If N is increased, the payload expansion factor is reduced inboth statistical and worst-case analysis—although the quantity of dataused by the start codes themselves is increased.

[0057] It should be appreciated that the above-described emulationprevention process does not depend on knowing how much data is in thepacket before starting to send it. Thus it adds no significant delay.

[0058] This formulation of the second-described method assumes that theinserted emulation prevention bytes are single bytes having the value Z.It is possible instead to use any value or multiple values or one ormore strings of values for the emulation prevention data, as long as thefirst byte of inserted data is not equal to W or X, which would emulatea valid start code or appear to be a continuation of the start of theprefix.

[0059] One can even carry information in these emulation preventionbytes (such as an H.263-style GOB frame ID/picture sequence number, forexample, or perhaps to set just the MSB to ‘1’ and use the other sevenbits to send an ASCII character).

[0060] If one considers what happens at the end of the packet on thedecoder side, we realize that it is easier to control the operation ifthe last byte of the data packet payload is not W. This means that thelast byte sent before a start code will never need to be an emulationprevention byte and that a detectable boundary can be located by thedecoder between the end of the payload data and the start of thesequence of bytes equal to W for the next start code. Forcing this to bethe case can also allow one to stuff in any amount of W bytes (e.g.,zero bytes) after the end of the payload and before the next start codewithout losing track of where the end of the payload is.

[0061] Data Stuffing

[0062] Normally, with video data, the data that is sent as the datapayload may not be an integer number of bytes. For example, one may have627 bits that are to be sent between two start codes. The systemmultiplex level may, however, operate in bytes. This is so for theMPEG-2 specification. Other reasons such as enabling the detection ofsome false start code patterns generated by transmission errors orenabling simple decoding processes for the data contents of thebeginning of the payload may also justify a desire for a packet tocontain an integer number of data units such as bytes. Thus, one mayhave to send a little more data in order to carry the 627 bits of data.The question then becomes how to pad out the data to make it an integernumber of bytes.

[0063] There are other situations when it would be useful to simply sendextra filler data. For example, if a channel has a capacity of 1Megabit/sec and the quantity of payload data to be sent is only 900kbits/sec, one may need or want to fill up the channel with filler data.

[0064] In accordance with one embodiment, a data stuffing techniqueenables extra data to be added to the channel to, in essence, pad thepayload data.

[0065]FIG. 2 is a flow diagram that describes steps in a data stuffingmethod in accordance with one embodiment in which the start codes areassumed to begin with a string of bits equal to zero. Step 200establishes the location of the end of the data that is intended to besent. Step 202 inserts a “1” bit after the last bit of payload data.Step 204 determines the number of additional bits required to send aninteger number of bytes. Step 206 inserts the required number of “0”bits after the inserted “1” bit. Step 208 adds any desired number ofbytes of filler data. The filler data may consist of any data patternsdesigned to avoid confusion over the locations of the true payload dataand of the intentional start codes. This is typically implemented byinserting bytes of value “0”.

[0066] As an example, consider the following. Assume that 627 bits areto be sent. Here, step 202 would insert a “1” bit after the 627^(th)bit. Step 204 would then determine that four more bits are required toprovide an integer number of bytes—here, 79 bytes. Accordingly, step 206would insert four “0”bits or 0000 after the inserted “1” bit. Now,having established an integer number of bytes, step 208 can, if sodesired, add any desired number of bytes of filler data. In thisparticular example, bytes having a value of 0 can be inserted. Thefiller data can be used simply as filler data, or for some other purposesuch as containing information that a decoder can use for some purpose.

[0067] Now, consider the situation at the decoder. The decoder receivesthe stuffed data and can start at the end of the data and look backwardsthrough the data. All of the bytes that the decoder initially sees willbe the 0 bytes until it gets to the byte with the “1” bit. The “1” bittells the decoder the location of the end of the payload or real data.Thus, once the decoder finds the “1” bit that was inserted, it candetermine exactly where the real data ends.

[0068] Thus, the techniques described above can be used to “round up”the number of bits that are sent so that the number of bits that aresent comprise an integer number of data units. Additionally, thesetechniques can be used to stuff filler data in between start codes thatdesignate the start of payload data.

[0069] Exemplary Computing Environment

[0070]FIG. 3 illustrates an example of a suitable computing environment300 on which the system and related methods described below can beimplemented.

[0071] It is to be appreciated that computing environment 300 is onlyone example of a suitable computing environment and is not intended tosuggest any limitation as to the scope of use or functionality of theencoding/decoding system described above. Neither should the computingenvironment 300 be interpreted as having any dependency or requirementrelating to any one or combination of components illustrated in theexemplary computing environment 300.

[0072] The various described embodiments can be operational withnumerous other general purpose or special purpose computing systemenvironments or configurations. Examples of well known computingsystems, environments, and/or configurations that may be suitable foruse with the media processing system include, but are not limited to,personal computers, server computers, thin clients, thick clients,hand-held or laptop devices, multiprocessor systems,microprocessor-based systems, set top boxes, programmable consumerelectronics, network PCs, minicomputers, mainframe computers,distributed computing environments that include any of the above systemsor devices, and the like.

[0073] In certain implementations, the system and related methods maywell be described in the general context of computer-executableinstructions, such as program modules, being executed by a computer.Generally, program modules include routines, programs, objects,components, data structures, etc. that perform particular tasks orimplement particular abstract data types. The embodiments can also bepracticed in distributed computing environments where tasks areperformed by remote processing devices that are linked through acommunications network. In a distributed computing environment, programmodules may be located in both local and remote computer storage mediaincluding memory storage devices. Components of the described computingsystem can be used to implement an encoder and a decoder that functionsas described above.

[0074] In accordance with the illustrated example embodiment of FIG. 3,computing system 300 is shown comprising one or more processors orprocessing units 302, a system memory 304, and a bus 306 that couplesvarious system components including the system memory 304 to theprocessor 302.

[0075] Bus 306 is intended to represent one or more of any of severaltypes of bus structures, including a memory bus or memory controller, aperipheral bus, an accelerated graphics port, and a processor or localbus using any of a variety of bus architectures. By way of example, andnot limitation, such architectures include Industry StandardArchitecture (ISA) bus, Micro Channel Architecture (MCA) bus, EnhancedISA (EISA) bus, Video Electronics Standards Association (VESA) localbus, and Peripheral Component Interconnects (PCI) bus also known asMezzanine bus.

[0076] Computer 300 typically includes a variety of computer readablemedia. Such media may be any available media that is locally and/orremotely accessible by computer 300, and it includes both volatile andnon-volatile media, removable and non-removable media.

[0077] In FIG. 3, the system memory 304 includes computer readable mediain the form of volatile, such as random access memory (RAM) 310, and/ornon-volatile memory, such as read only memory (ROM) 308. A basicinput/output system (BIOS) 312, containing the basic routines that helpto transfer information between elements within computer 300, such asduring start-up, is stored in ROM 308. RAM 310 typically contains dataand/or program modules that are immediately accessible to and/orpresently be operated on by processing unit(s) 302.

[0078] Computer 300 may further include other removable/non-removable,volatile/non-volatile computer storage media. By way of example only,FIG. 3 illustrates a hard disk drive 328 for reading from and writing toa non-removable, non-volatile magnetic media (not shown and typicallycalled a “hard drive”), a magnetic disk drive 330 for reading from andwriting to a removable, non-volatile magnetic disk 332 (e.g., a “floppydisk”), and an optical disk drive 334 for reading from or writing to aremovable, non-volatile optical disk 336 such as a CD-ROM, DVD-ROM orother optical media. The hard disk drive 328, magnetic disk drive 330,and optical disk drive 334 are each connected to bus 306 by one or moreinterfaces 326.

[0079] The drives and their associated computer-readable media providenonvolatile storage of computer readable instructions, data structures,program modules, and other data for computer 300. Although the exemplaryenvironment described herein employs a hard disk 328, a removablemagnetic disk 332 and a removable optical disk 336, it should beappreciated by those skilled in the art that other types of computerreadable media which can store data that is accessible by a computer,such as magnetic cassettes, flash memory cards, digital video disks,random access memories (RAMs), read only memories (ROM), and the like,may also be used in the exemplary operating environment.

[0080] A number of program modules may be stored on the hard disk 328,magnetic disk 332, optical disk 336, ROM 308, or RAM 310, including, byway of example, and not limitation, an operating system 314, one or moreapplication programs 316 (e.g., multimedia application program 324),other program modules 318, and program data 320. A user may entercommands and information into computer 300 through input devices such askeyboard 338 and pointing device 340 (such as a “mouse”). Other inputdevices may include a audio/video input device(s) 353, a microphone,joystick, game pad, satellite dish, serial port, scanner, or the like(not shown). These and other input devices are connected to theprocessing unit(s) 302 through input interface(s) 342 that is coupled tobus 306, but may be connected by other interface and bus structures,such as a parallel port, game port, or a universal serial bus (USB).

[0081] A monitor 356 or other type of display device is also connectedto bus 306 via an interface, such as a video adapter or video/graphicscard 344. In addition to the monitor, personal computers typicallyinclude other peripheral output devices (not shown), such as speakersand printers, which may be connected through output peripheral interface346.

[0082] Computer 300 may operate in a networked environment using logicalconnections to one or more remote computers, such as a remote computer350. Remote computer 350 may include many or all of the elements andfeatures described herein relative to computer.

[0083] As shown in FIG. 3, computing system 300 is communicativelycoupled to remote devices (e.g., remote computer 350) through a localarea network (LAN) 351 and a general wide area network (WAN) 352. Suchnetworking environments are commonplace in offices, enterprise-widecomputer networks, intranets, and the Internet.

[0084] When used in a LAN networking environment, the computer 300 isconnected to LAN 351 through a suitable network interface or adapter348. When used in a WAN networking environment, the computer 300typically includes a modem 354 or other means for establishingcommunications over the WAN 352. The modem 354, which may be internal orexternal, may be connected to the system bus 306 via the user inputinterface 342, or other appropriate mechanism.

[0085] In a networked environment, program modules depicted relative tothe personal computer 300, or portions thereof, may be stored in aremote memory storage device. By way of example, and not limitation,FIG. 3 illustrates remote application programs 316 as residing on amemory device of remote computer 350. It will be appreciated that thenetwork connections shown and described are exemplary and other means ofestablishing a communications link between the computers may be used.

[0086] Conclusion

[0087] Some of the above described methods and systems can provide forstart code emulation prevention at a level of processing that is otherthan the bit level. This is advantageous because it can ease processingcomplexities. The techniques described in this document can be employedin any suitable context, e.g. in connection with payload containingcontent created by variable length codes, Huffman codes and arithmeticcoding. Additionally, some embodiments provide a straightforward methodfor data stuffing that can ensure that an integer number of bytes aresent when desired and that can allow for the sending of additionalfiller data in addition to the data for the start codes, emulationprevention patterns, and basic payload data.

[0088] Although the invention has been described in language specific tostructural features and/or methodological steps, it is to be understoodthat the invention defined in the appended claims is not necessarilylimited to the specific features or steps described. Rather, thespecific features and steps are disclosed as preferred forms ofimplementing the claimed invention.

1. A method comprising: searching for at least one pattern of fixed-sizedata portions within data that is intended for encoding transmission inan environment using start codes, individual fixed-size data portionscomprising at least two bits; and responsive to finding a pattern,inserting start code emulation prevention data relative to the data thatcontains the pattern.
 2. The method of claim 1, wherein the act ofsearching is performed by searching video data.
 3. The method of claim1, wherein the act of searching is performed by searching audio data. 4.The method of claim 1, wherein the act of searching is performed bysearching audio/video data.
 5. The method of claim 1, wherein the act ofsearching is performed by searching for one or more patterns at leastone of which comprises at least two fixed-size data portions.
 6. Themethod of claim 1, wherein the act of searching is performed bysearching for multiple patterns.
 7. The method of claim 1, wherein theact of searching is performed by searching for multiple patterns atleast some of which have different lengths.
 8. The method of claim 1,wherein the act of searching is performed by searching for multiplepatterns, individual patterns being structured as a prefix followed by atype-indication suffix.
 9. The method of claim 1, wherein the act ofsearching is performed by searching for multiple patterns, individualpatterns being structured as a prefix followed by a type-indicationsuffix, wherein one or more of each pattern's prefix length andtype-indication suffix can differ in length from prefix lengths andtype-indication suffix lengths of other patterns.
 10. The method ofclaim 1, wherein the act of inserting start code emulation preventiondata comprises selecting from among multiple different patterns ofemulation prevention data.
 11. The method of claim 1, wherein the act ofinserting start code emulation prevention data comprises selecting fromamong multiple different patterns of emulation prevention dataindividual ones of which can have different lengths.
 12. The method ofclaim 1, wherein the act of inserting the start code emulationprevention data comprises inserting more than one bit.
 13. The method ofclaim 1, wherein the act of inserting the start code emulationprevention data comprises inserting an amount of data is that equal innumber of bits to an individual fixed-size data portion.
 14. The methodof claim 1 further comprising transmitting data that contains start codeemulation prevention data.
 15. The method of claim 1, wherein the actsof searching and inserting are performed by an encoder.
 16. One or morecomputer-readable media embodying an encoder that is configured to:search for at least one pattern of fixed-size data portions within datathat is intended for transmission in an environment using start codes,individual fixed-size data portions comprising at least two bits; andresponsive to finding a pattern, insert start code emulation preventiondata relative to the data that contains the pattern.
 17. One or morecomputer-readable media embodying instructions which, when executed byone or more processors, cause the one or more processors to: search forat least one pattern of fixed-size data portions within data that isintended for transmission in an environment using start codes,individual fixed-size data portions comprising at least two bits; andresponsive to finding a pattern, insert start code emulation preventiondata relative to the data that contains the pattern.
 18. Thecomputer-readable media of claim 17, wherein the instructions cause theone or more processors to process video data.
 19. The computer-readablemedia of claim 17, wherein the instructions cause the one or moreprocessors to process audio data.
 20. The computer-readable media ofclaim 17, wherein the instructions cause the one or more processors toprocess audio/video data.
 21. The computer-readable media of claim 17,wherein the instructions cause the one or more processors to search forone or more patterns at least one of which comprises at least twofixed-size data portions.
 22. The computer-readable media of claim 17,wherein the instructions cause the one or more processors to insertstart code emulation prevention data comprising more than one bit. 23.The computer-readable media of claim 17, wherein the instructions causethe one or more processors to insert an amount of data is that equal innumber of bits to an individual fixed-size data portion.
 24. Thecomputer-readable media of claim 17, wherein the instructions cause theone or more processors to transmit data that contains start codeemulation prevention data.
 25. A method comprising: searching for atleast one byte-level pattern within data that is intended fortransmission in an environment using start codes, the pattern beingdefined by multiple bytes; and responsive to finding a pattern,inserting start code emulation prevention data relative to the data thatcontains the pattern.
 26. The method of claim 25, wherein the act ofsearching is performed by searching video data.
 27. The method of claim25, wherein the act of searching is performed by searching audio data.28. The method of claim 25, wherein the act of searching is performed bysearching audio/video data.
 29. The method of claim 25, wherein the actof inserting the start code emulation prevention data comprisesinserting at least one byte.
 30. The method of claim 25 furthercomprising transmitting data that contains start code emulationprevention data.
 31. The method of claim 25, wherein the acts ofsearching and inserting are performed by an encoder.
 32. One or morecomputer-readable media embodying an encoder that is configured to:obtain data that is intended for transmission in an environment usingstart codes; search for at least one byte-level pattern within thereceived data, the pattern being defined by multiple bytes; andresponsive to finding a pattern, insert a start code emulationprevention byte relative to the data that contains the pattern.
 33. Oneor more computer-readable media embodying instructions which, whenexecuted by one or more processors, cause the one or more processors to:obtain data that is intended for transmission in an environment usingstart codes; search for at least one byte-level pattern within thereceived data, the pattern being defined by multiple bytes; andresponsive to finding a pattern, insert a start code emulationprevention byte relative to the data that contains the pattern.
 34. Amethod comprising: receiving data that has been encoded with start codeemulation prevention data to prevent emulation of start codes,individual instances of the start code emulation prevention datacomprising multiple bits; searching for legitimate start codes withinthe received data; searching the received data to identify start codeemulation prevention data; and responsive to finding the start codeemulation prevention data, removing the start code emulation preventiondata.
 35. The method of claim 34, wherein the act of receiving isperformed by receiving video data.
 36. The method of claim 34, whereinthe act of receiving is performed by receiving audio data.
 37. Themethod of claim 34, wherein the act of receiving is performed byreceiving audio/video data.
 38. The method of claim 34, wherein therecited acts are performed by a decoder.
 39. One or more computersystems programmed to implement the method of claim
 34. 40. One or morecomputer-readable media embodying a decoder that is configured to:receive data that has been encoded with start code emulation preventiondata to prevent emulation of start codes, individual instances of thestart code emulation prevention data comprising multiple bits; searchfor legitimate start codes within the received data; search the receiveddata to identify start code emulation prevention data; and responsive tofinding the start code emulation prevention data, remove the start codeemulation prevention data.
 41. A method comprising: receiving data thathas been encoded with start code emulation prevention data to preventemulation of start codes, individual instances of the start codeemulation prevention data comprising one or more fixed-size data units;searching for legitimate start codes within the received data; searchingthe received data to identify start code emulation prevention data;responsive to finding the start code emulation prevention data, removingthe start code emulation prevention data.
 42. The method of claim 41,wherein the act of receiving is performed by receiving video data. 43.The method of claim 41, wherein the act of receiving is performed byreceiving audio data.
 44. The method of claim 41, wherein the act ofreceiving is performed by receiving audio/video data.
 45. The method ofclaim 41, wherein a fixed-size data unit comprises a byte.
 46. One ormore computer-readable media embodying instructions which, when executedby one or more processors, cause the one or more processors to implementthe method of claim
 41. 47. A decoder configured to: receive data thathas been encoded with start code emulation prevention data to preventemulation of start codes, individual instances of the start codeemulation prevention data comprising one or more bytes; search forlegitimate start codes within the received data; search the receiveddata to identify start code emulation prevention data; and responsive tofinding the start code emulation prevention data, remove the start codeemulation prevention data.
 48. One or more computer systems embodyingthe decoder of claim
 47. 49. A method comprising: obtaining data that isintended for transmission in an environment that uses start codes;searching for at least one pattern within the data, the patterncomprising a string of N+1 bytes of payload data that match either (1)an entire start code prefix, or (2) the first N bytes of a start codeprefix plus the value of an emulation prevention byte; and responsive tofinding the pattern, inserting a start code emulation prevention byterelative to the data that contains the pattern.
 50. The method of claim49, wherein the start code prefix starts at a byte-aligned position. 51.The method of claim 49, wherein the pattern comprises N bytes that havethe same value, and another byte that has a different value.
 52. Themethod of claim 49, wherein the pattern comprises N bytes that have avalue of 0, and another byte that has a different value.
 53. The methodof claim 49, wherein N=2.
 54. The method of claim 49, wherein the startcode emulation prevention byte has a value that is different from thevalues of any bytes of the start code prefix.
 55. The method of claim49, wherein the act of obtaining is performed by obtaining video data.56. The method of claim 49, wherein the act of obtaining is performed byobtaining audio data.
 57. The method of claim 49, wherein the act ofobtaining is performed by obtaining audio/video data.
 58. The method ofclaim 49 further comprising transmitting data that contains one or morestart code emulation bytes.
 59. The method of claim 49, wherein the actsof obtaining, searching and inserting are performed by an encoder. 60.One or more computer-readable media embodying instructions which, whenexecuted by one or more processors, cause the one or more processors to:obtain data that is intended for transmission in an environment thatuses start codes; search for at least one pattern within the obtaineddata, the pattern comprising a string of N+1 bytes of payload data thatmatch either (1) an entire start code prefix, or (2) the first N bytesof a start code prefix plus the value of an emulation prevention byte;and responsive to finding the pattern, insert a start code emulationprevention byte relative to the data that contains the pattern.
 61. Theone or more computer-readable media of claim 60, wherein the start codeprefix starts at a byte-aligned position.
 62. The one or morecomputer-readable media of claim 60, wherein the pattern comprises Nbytes that have the same value, and another byte that has a differentvalue.
 63. The one or more computer-readable media of claim 60, whereinthe pattern comprises N bytes that have a value of 0, and another bytethat has a different value.
 64. The one or more computer-readable mediaof claim 60, wherein N=2.
 65. The one or more computer-readable media ofclaim 60, wherein the start code emulation prevention byte has a valuethat is different from the values of any bytes of the start code prefix.66. The one or more computer-readable media of claim 60, wherein theinstructions cause the one or more processors to obtain and processvideo data.
 67. The one or more computer-readable media of claim 60,wherein the instructions cause the one or more processors to obtain andprocess audio data.
 68. The one or more computer-readable media of claim60, wherein the instructions cause the one or more processors to obtainand process audio/video data.
 69. The one or more computer-readablemedia of claim 60, wherein the instructions cause the one or moreprocessors to transmit data that contains one or more start codeemulation bytes.
 70. One or more computer systems embodying the one ormore computer-readable media of claim
 60. 71. A method comprising:receiving data that has been processed to contain one or more start codeemulation prevention bytes to prevent emulation of start codes, the databeing processed in accordance with a rule that: searches for at leastone data pattern, the one data pattern comprising a string of N+1 bytesof payload data that matches either (1) an entire start code prefix, or(2) the first N bytes of a start code prefix plus the value of anemulation prevention byte; and inserts a start code emulation preventionbyte relative to the data that contains the pattern; searching forlegitimate start codes within the received data; searching the receiveddata to identify start code emulation prevention bytes; and responsiveto finding a start code emulation prevention byte, removing the startcode emulation prevention byte.
 72. The method of claim 71, wherein theact of receiving is performed by receiving video data.
 73. The method ofclaim 71, wherein the act of receiving is performed by receiving audiodata.
 74. The method of claim 71, wherein the act of receiving isperformed by receiving audio/video data.
 75. The method of claim 71,wherein the recited acts are performed by a decoder.
 76. The method ofclaim 71, wherein the data pattern comprises N bytes that have the samevalue, and another byte that has a different value.
 77. The method ofclaim 71, wherein the data pattern comprises N bytes having a value of0, and another byte that has a different value.
 78. The method of claim71, wherein the start code emulation prevention byte has a value that isdifferent from the values of any bytes of the start code prefix.
 79. Oneor more computer-readable media embodying instructions which, whenexecuted by one or more processors, cause the one or more processors toimplement the method of claim
 71. 80. A computer system comprising: oneor more computer-readable media; one or more processors; andcomputer-readable instructions embodied on the computer-readable mediawhich, when executed by the one or more processors, cause the one ormore processors to implement the method of claim
 71. 81. A methodcomprising: obtaining data that is intended for transmission in anenvironment that uses start codes; searching for at least one patternwithin the data, the pattern comprising a string of N+1 bytes of payloaddata that matches either (1) an entire start code prefix, or (2) thefirst N bytes of a start code prefix plus the value of an emulationprevention byte, wherein the pattern comprises N bytes that have thesame value, and another byte that has a different value; and responsiveto finding the pattern, inserting a start code emulation prevention byterelative to the data that contains the pattern, the start code emulationprevention byte having a value that is different from the values of anybytes of the start code prefix.
 82. The method of claim 81, wherein thestart code prefix starts at a byte-aligned position.
 83. The method ofclaim 81, wherein the N bytes have a value of
 0. 84. The method of claim81, wherein N=2.
 85. The method of claim 81, wherein the act ofobtaining is performed by receiving video data.
 86. The method of claim81, wherein the act of obtaining is performed by obtaining audio data.87. The method of claim 81, wherein the act of obtaining is performed byobtaining audio/video data.
 88. The method of claim 81 furthercomprising transmitting data that contains one or more start codeemulation bytes.
 89. The method of claim 81, wherein the acts ofobtaining, searching and inserting are performed by an encoder.
 90. Amethod comprising: receiving data that has been processed to include oneor more start code emulation prevention bytes to prevent emulation ofstart codes, the data being processed in accordance with a rule that:searches for at least one data pattern, the one data pattern comprisinga string of N+1 bytes of payload data that matches either (1) an entirestart code prefix, or (2) the first N bytes of a start code prefix plusthe value of an emulation prevention byte, wherein the pattern comprisesN bytes that have the same value, and another byte that has a differentvalue, and inserts a start code emulation prevention byte relative tothe data that contains the pattern, wherein the start code emulationbyte has a value that is different from any bytes of the start codeprefix; searching for legitimate start codes within the data; searchingthe data to identify start code emulation prevention bytes; andresponsive to finding a start code emulation prevention byte, removingthe start code emulation prevention byte.
 91. The method of claim 90,wherein the act of receiving is performed by receiving video data. 92.The method of claim 90, wherein the act of receiving is performed byreceiving audio data.
 93. The method of claim 90, wherein the act ofreceiving is performed by receiving audio/video data.
 94. The method ofclaim 90, wherein the recited acts are performed by a decoder.
 95. Themethod of claim 90, wherein the N bytes have a value of
 0. 96. A methodcomprising: obtaining data that is intended for transmission in anenvironment that uses start codes; searching for at least one patternwithin the data, the pattern comprising a string of N bytes of payloaddata that match the first N bytes of a start code prefix; and responsiveto finding the pattern, inserting a start code emulation prevention byterelative to the data that contains the pattern.
 97. The method of claim96, wherein the start code prefix starts at a byte-aligned position. 98.The method of claim 96, wherein the pattern comprises N bytes that havethe same value.
 99. The method of claim 96, wherein the patterncomprises N bytes that have a value of
 0. 100. The method of claim 96,wherein N=2.
 101. The method of claim 96, wherein the start codeemulation prevention byte has a value that is different from the valuesof any bytes of the start code prefix.
 102. The method of claim 96,wherein the act of obtaining is performed by obtaining video data. 103.The method of claim 96, wherein the act of obtaining is performed byobtaining audio data.
 104. The method of claim 96, wherein the act ofobtaining is performed by obtaining audio/video data.
 105. The method ofclaim 96 further comprising transmitting data that contains one or morestart code emulation bytes.
 106. The method of claim 96, wherein theacts of obtaining, searching and inserting are performed by an encoder.107. One or more computer-readable media embodying instructions which,when executed by one or more processors, cause the one or moreprocessors to implement the method of claim
 96. 108. A computer systemcomprising: one or more computer-readable media; one or more processors;and computer-readable instructions embodied on the computer-readablemedia which, when executed by the one or more processors, cause the oneor more processors to implement the method of claim
 96. 109. A methodcomprising: obtaining data that is intended for transmission in anenvironment that uses start codes; searching for at least one patternwithin the data, the pattern comprising a string of N bytes of payloaddata that match the first N bytes of a start code prefix, the patterncomprising N bytes that have the same value; responsive to finding thepattern, inserting a start code emulation prevention byte relative tothe data that contains the pattern, the start code emulation preventionbyte having a value that is different from the values of any bytes ofthe start code prefix.
 110. The method of claim 109, wherein the startcode prefix starts at a byte-aligned position.
 111. The method of claim109, wherein the N bytes have a value of
 0. 112. The method of claim109, wherein N=2.
 113. The method of claim 109, wherein the act ofobtaining is performed by obtaining video data.
 114. The method of claim109, wherein the act of obtaining is performed by obtaining audio data.115. The method of claim 109, wherein the act of obtaining is performedby obtaining audio/video data.
 116. The method of claim 109 furthercomprising transmitting data that contains one or more start codeemulation bytes.
 117. The method of claim 109, wherein the acts ofobtaining, searching and inserting are performed by an encoder.
 118. Oneor more computer-readable media embodying instructions which, whenexecuted by one or more processors, cause the one or more processors toimplement the method of claim
 109. 119. A computer system comprising:one or more computer-readable media; one or more processors; andcomputer-readable instructions embodied on the computer-readable mediawhich, when executed by the one or more processors, cause the one ormore processors to implement the method of claim
 109. 120. A methodcomprising: receiving data that has been processed to include one ormore start code emulation prevention bytes to prevent emulation of startcodes, the data being processed in accordance with a rule that: searchesfor at least one pattern within the data, the pattern comprising astring of N bytes of payload data that match the first N bytes of astart code prefix, and inserts a start code emulation prevention byterelative to the data that contains the pattern; searching for legitimatestart codes within the data; searching the data to identify start codeemulation prevention bytes; and responsive to finding a start codeemulation prevention byte, removing the start code emulation preventionbyte.
 121. The method of claim 120, wherein the act of receiving isperformed by receiving video data.
 122. The method of claim 120, whereinthe act of receiving is performed by receiving audio data.
 123. Themethod of claim 120, wherein the act of receiving is performed byreceiving audio/video data.
 124. The method of claim 120, wherein therecited acts are performed by a decoder.
 125. The method of claim 120,wherein the data pattern comprises N bytes that have the same value.126. The method of claim 120, wherein the data pattern comprises N bytesthat have a value of
 0. 127. The method of claim 120, wherein N=2. 128.The method of claim 120, wherein the start code emulation preventionbyte has a value that is different from the values of any bytes of thestart code prefix.
 129. One or more computer-readable media embodyinginstructions which, when executed by one or more processors, cause theone or more processors to implement the method of claim
 120. 130. Acomputer system comprising: one or more computer-readable media; one ormore processors; and computer-readable instructions embodied on thecomputer-readable media which, when executed by the one or moreprocessors, cause the one or more processors to implement the method ofclaim
 120. 131. A method comprising: searching for at least one patternof fixed-size data portions within data that is intended for encodingtransmission in an environment using start codes, individual fixed-sizedata portions comprising at least two bits; responsive to finding apattern, inserting start code emulation prevention data relative to thedata that contains the pattern; establishing a location corresponding tothe end of payload data that is intended to be sent to one or morereceivers after a start code; and inserting one or more bits ofadditional filler data after the end of the payload data and prior to anext start code.
 132. The method of claim 131, wherein the act ofinserting one or more bits comprises inserting individual data unitseach of which comprise multiple bits.
 133. The method of claim 131,wherein the act of inserting one or more bits comprises insertingindividual data units each of which comprises at least one byte. 134.The method of claim 131, wherein said filler data comprises a datapattern that is designed to avoid confusion with payload data.
 135. Themethod of claim 131, wherein said filler data comprises a data patternthat is designed to avoid confusion with start codes.
 136. A methodcomprising: receiving data that has been processed to compriseadditional filler data that has been added after a first start code andassociated payload data and prior to a second start code and which hasbeen processed to include start code emulation prevention data toprevent emulation of start codes, individual instances of the start codeemulation prevention data comprising multiple bits; searching forlegitimate start codes within the received data; searching the receiveddata to identify start code emulation prevention data; responsive tofinding the start code emulation prevention data, removing the startcode emulation prevention data; ascertaining the filler data; andremoving the filler data.
 137. The method of claim 136, wherein thefiller data comprises individual bytes.
 138. The method of claim 136,wherein the filler data comprises units of multiple bits.
 139. Themethod of claim 136, wherein the filler data comprises a data patternthat is designed to avoid confusion with the payload data.
 140. Themethod of claim 136, wherein the filler data comprises a data patternthat is designed to avoid confusion with start codes.
 141. A methodcomprising: searching for at least one pattern of fixed-size dataportions within data that is intended for encoding transmission in anenvironment using start codes, individual fixed-size data portionscomprising at least two bits; responsive to finding a pattern, insertingstart code emulation prevention data relative to the data that containsthe pattern; establishing a location corresponding to the end of payloaddata that is intended to be sent to one or more receivers, wherein thepayload data can comprise start code emulation prevention data; firstinserting one or more bits after a last bit of payload data, theinserted one or more bits having one or more predetermined values;determining a number of bits that are required to send, as payload data,an integer number of data units; and inserting, if necessary, asufficient number of additional bits after the first-inserted bit(s) toprovide an integer number of data units.
 142. The method of claim 141,wherein said inserting of a sufficient number of additional bits cancomprise inserting a sufficient number of bytes.
 143. The method ofclaim 141, wherein said inserting of a sufficient number of additionalbits can comprise inserting a sufficient number of 0 bytes.
 144. Themethod of claim 141, wherein said inserting of a sufficient number ofadditional bits comprises inserting said bits before a subsequent startcode.
 145. The method of claim 141, wherein said inserting of asufficient number of additional bits comprises inserting said bitshaving a data pattern that is designed to avoid confusion with payloaddata.
 146. The method of claim 141, wherein said inserting of asufficient number of additional bits comprises inserting said bitshaving a data pattern that is designed to avoid confusion with one ormore start codes.
 147. A method comprising: receiving data comprisingpayload data and inserted data, wherein said payload data can comprisestart code emulation prevention data to prevent emulation of startcodes, individual instances of the start code emulation prevention datacomprising multiple bits, said inserted data comprising (a) at least onebit after the last bit of payload data and having a predetermined value,(b) a sufficient number of additional bits to provide an integer numberof data units which include the payload data; searching for legitimatestart codes within the received data; searching the received data toidentify start code emulation prevention data; responsive to finding thestart code emulation prevention data, removing the start code emulationprevention data; ascertaining the inserted data; and removing theinserted data.
 148. The method of claim 147, wherein said sufficientnumber of additional bits comprises an integer number of bytes.
 149. Themethod of claim 147, wherein said sufficient number of additional bitscomprises an integer number of 0 bytes.
 150. The method of claim 147,wherein said sufficient number of additional bits comprises an integernumber of bytes before a subsequent start code.
 151. A methodcomprising: establishing a location corresponding to the end of payloaddata that is intended to be sent to one or more receivers; inserting a 1bit after the last bit of payload data; determining a number of bitsthat are required to send, as payload data, an integer number of bytes;inserting a sufficient number of 0 bits after the inserted 1 bit toprovide an integer number of bytes; and inserting one or more bytes offiller data after the inserted number of 0 bits or, if no 0 bits wereinserted to provide an integer number of bytes, after the inserted 1bit.
 152. The method of claim 151, wherein the act of inserting thefiller data comprises inserting one or more 0 bytes.
 153. A methodcomprising: receiving data comprising payload data and inserted data,said inserted data having been inserted in accordance with the followinginsertion processing: a location corresponding to the end of the payloaddata is established; a 1 bit is inserted after the last bit of payloaddata; a number of bits that are required to send, as payload data, aninteger number of bytes is determined; a sufficient number of 0 bitsafter the inserted 1 bit are inserted to provide an integer number ofbytes; and one or more bytes of filler data after the inserted number of0 bits are inserted or, if no 0 bits were inserted to provide an integernumber of bytes, one or more bytes of filler data are inserted after theinserted 1 bit ascertaining the inserted data; and removing the inserteddata.
 154. A method comprising: establishing a location corresponding tothe end of payload data that is intended to be sent to one or morereceivers; first inserting at least one bit after the last bit ofpayload data, the inserted one or more bits having one or morepredetermined values; determining a number of bits that are required tosend, as payload data, an integer number of data units; secondinserting, if necessary, a sufficient number of additional bits afterthe first-inserted bit(s) to provide an integer number of data units;and inserting one or more data units of filler data after the first andsecond inserted bits.
 155. The method of claim 154, wherein individualdata units comprise individual bytes.
 156. The method of claim 154,wherein individual data units comprise multiple bits.
 157. The method ofclaim 154, wherein said filler data comprises a data pattern that isdesigned to avoid confusion with the payload data.
 158. The method ofclaim 154, wherein said filler data comprises a data pattern that isdesigned to avoid confusion with start codes.
 159. A method comprising:receiving data comprising payload data and inserted data, said inserteddata having been inserted in accordance with the following insertionprocessing: a location corresponding to the end of the payload data thatis intended to be sent is established; at least one bit is firstinserted after the last bit of payload data, the inserted one or morebits having one or more predetermined values; a number of bits that arerequired to send, as payload data, an integer number of data units aredetermined; if necessary, a sufficient number of additional bits aresecond inserted after the first-inserted bit(s) to provide an integernumber of data units; and one or more data units of filler data areinserted after the first and second inserted bits. ascertaining theinserted data; and removing the inserted data.
 160. The method of claim159, wherein individual data units comprise individual bytes.
 161. Themethod of claim 159, wherein individual data units comprise multiplebits.
 162. The method of claim 159, wherein said filler data comprises adata pattern that is designed to avoid confusion with the payload data.163. The method of claim 159, wherein said filler data comprises a datapattern that is designed to avoid confusion with start codes.